﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class EndPoint : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            Time.timeScale = 0;
            BackMusic.instance.Stop();
            GameDataMgr.Instance.AddRank(GameDataMgr.Instance.GetNickName(), GamePanel.Instance.NowScore, (int)GamePanel.Instance.NowTime);
            ConfirmPanel.Instance.InitConfirmPanel("通关", "恭喜通关", "返回上一级", "再次挑战",
             delegate ()
             {
                 Time.timeScale = 1;
                 SceneManager.LoadScene("Start");
             },
             delegate ()
             {
                 Time.timeScale = 1;
                 SceneManager.LoadScene("Game");
             });
            ConfirmPanel.Instance.Show();
        }
    }
}
